package mk.timska_rabota_android;

import mk.timska_rabota_android.location.LocationModule;
import mk.timska_rabota_android.messages.MessagesModule;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.internal.ay;

import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.AutoCompleteTextView;
import android.widget.TextView;
import android.widget.Toast;

public class STFMessage extends Activity {
	final STFMessage thisClass = this;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_stfmessage);
		
		LocationModule.UpdateLocation(getApplicationContext(), thisClass);
		LocationModule.getLastKnownLocation(getApplicationContext(), thisClass);
		
	}
	
	public class LongRunningGetIO extends AsyncTask <Void, Void, String> {

		@Override
		protected String doInBackground(Void... arg0) {
			LocationModule.UpdateLocation(getApplicationContext(), thisClass);
			LocationModule.getLastKnownLocation(getApplicationContext(), thisClass);
			return null;
		}
	
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_stfmessage, menu);
		return true;
	}
	
	public void sendMessage(View v) {
		AutoCompleteTextView lat = (AutoCompleteTextView)findViewById(R.id.latitude);
		AutoCompleteTextView lon = (AutoCompleteTextView)findViewById(R.id.longitude);
		if(LocationModule.Network != null){
			lat.setText(Double.toString(LocationModule.Network.getLatitude()));
			lon.setText(Double.toString(LocationModule.Network.getLongitude()));
		}
	}
	
	

}
